using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MSRI.HelperClasses;

namespace MSRI.DesktopAgent
{
    public partial class SendSmsForm : Form
    {
        public SendSmsForm()
        {
            InitializeComponent();
        }

        private void SendButton_Click(object sender, EventArgs e)
        {
            if (NumberTextBox.Text.Trim() != "")
            {
                SmsClass SmsMessage = new SmsClass(NumberTextBox.Text, BodyTextBox.Text);
                ((AgentForm)this.Tag).SentTableUpdate("Enumator", SmsMessage);
                this.Close();
                ((AgentForm)this.Tag).Show();
            }
            else
                MessageBox.Show("Please enter a valid mobile number","Invalid Mobile");
        }

        private void CancelSendButton_Click(object sender, EventArgs e)
        {
            this.Close();
            ((AgentForm)this.Tag).Show();
        }

        private void SendSmsForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            ((AgentForm)this.Tag).Show();
        }

        private void BodyTextBox_TextChanged(object sender, EventArgs e)
        {
            bodylengthLabel.Text = BodyTextBox.Text.Trim().Length.ToString();
        }
    }
}